package com.atomway.consumer.feign;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.atomway.consumer.user.entity.User;

@FeignClient(name = "atomway-system-user",fallback=UserFeignClientHytrix.class)
public interface UserFeignClient {

	@RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
	public User findById(@PathVariable("id") Long id);
}

@Component
class UserFeignClientHytrix implements UserFeignClient {

	@Override
	public User findById(Long id) {
		User user = new User();
		user.setId(-1L);
		return user;
	}
	
}